package com.sudo.boot.admin._sys;

import com.mybatisflex.core.paginate.Page;
import com.sudo.boot.base.pojo.JsonRes;
import com.sudo.boot.mapper.sys.entity.SysJobLog;
import com.sudo.boot.mapper.sys.model.bo.SysJobLogBo;
import com.sudo.boot.service.sys.SysJobLogService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("sys-job-log")
public class SysJobLogController {

    @Resource
    private SysJobLogService sysJobLogService;

    @GetMapping("/page")
    public JsonRes<Page<SysJobLog>> getSysJobLogByPage(@Validated SysJobLogBo bo) {
        Page<SysJobLog> page = sysJobLogService.querySysJobLogByPage(bo);
        return JsonRes.ok(page);
    }

    @GetMapping("/detail/{id}")
    public JsonRes<SysJobLog> getSysJobLogById(@PathVariable Integer id) {
        SysJobLog sysJobLog = sysJobLogService.getSysJobLog(id);
        return JsonRes.ok(sysJobLog);
    }
}
